package zhihuilan.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import zhihuilan.common.Response;

@Getter
@RequiredArgsConstructor
public enum Errors {
    UNKNOWN(10000, "系统繁忙，请稍后再试"),
    NOT_LOGIN(10001, "未获取到登陆信息"),
    GPT_ERROR(10002, "GPT繁忙，请稍后再试"),
    PARAM_ERROR(10010, "参数不正确"),

    LOGINOUT_TIME(10002,"登陆超时"),
    NOT_FOUND(20001, "资源不存在"),
    DEVICE_LOCKED(30001, "设备已锁定"),
    STUDENT_UNBIND(40001, "请先在家长端绑定学生信息"),
    ALGORITHM_ERROR(99999,"算法错误"),
    ALGORITHM_NULL(100000,"算法返回空"),
    DATACHECK_CHECKINTODAY(1010,"今日已打卡"),
    STAGE_NOT_FOUND(1020,"未找到该阶段");


    private final int code;

    private final String msg;

    public <T> Response<T> toResponse() {
        return Response.error(code, msg);
    }

    public <T> Response<T> toResponse(String msg) {
        return Response.error(code, msg);
    }

    public <T> Response<T> toResponse(T data) {
        return Response.error(code, msg, data);
    }

    public <T> Response<T> toResponse(T data, String msg) {
        return Response.error(code, msg, data);
    }
}
